
package jpoco.client;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 
 *  Xml Schema Date Time (xs:dateTime)
 *
 *  @see http://www.w3.org/TR/xmlschema-2/#dateTime
 *
 */
public class XmlDateTime   
{

	public static final String XML_SCHEMA_DATETIME_PATTERN = "yyyy-MM-dd'T'hh:mm:ssZ";

	public static String toString(Calendar c)
	{
		return toString(c.getTime());
	}
	
	public static String toString(Date d)
	{
		SimpleDateFormat fmt = new SimpleDateFormat(XML_SCHEMA_DATETIME_PATTERN);
		
		return fmt.format(d);
	}

	public static String toString(long time)
	{
		Calendar c = Calendar.getInstance();
		c.setTimeInMillis(time);
		
		return toString(c);
	}
	
}
